<?
# Itty Bitty Stuff!
function setBit(&$set,$bit) {
   settype($set,'integer');
   settype($bit,'integer');
   return $set |= $bit;
}
function removeBit(&$set,$bit) {
   settype($set,'integer');
   settype($bit,'integer');
   return $set &= ~$bit;
}
function switchBit(&$set,$bit) {
   if ($set & $bit) {
     return removeBit($set,$bit);
   } else {
     return setBit($set,$bit);
   }
}
function bitwise($int) {
   if ($int < 0) {
     $invert = true;
     $int *= -1;
   }
   for ($x = 0;$x<=log($int,2);$x++) {
      $result = (($int & pow(2,$x)) ? '1':'0').$result;
   }
   if ($invert) {
    $result = '1x'.str_replace('2','1',str_replace('1','0',str_replace('0','2',$result)));
   } else {
    $result = '0x'.$result;
   }
   return $result;
}
?>